#include <boost/asio/io_context.hpp>
#if !defined(__HTTP_SERVER)
#    define __HTTP_SERVER

#    include "HttpSession.hpp"

#    include <boost/asio/ip/tcp.hpp>
#    include <boost/asio/ssl/stream.hpp>
#    include <boost/asio/strand.hpp>
#    include <boost/beast/core.hpp>
#    include <boost/beast/http.hpp>
#    include <boost/beast/ssl.hpp>
#    include <boost/beast/version.hpp>
#    include <boost/config.hpp>
#    include <map>
#    include <string>
namespace rdhttp {

    using HttpRequest       = HttpSession::HttpRequest;
    using HttpResponse      = HttpSession::HttpResponse;
    using HttpRequestParser = HttpSession::HttpRequestParser;
    using RequestHandler    = HttpSession::RequestHandler;
    using PosttHandler      = HttpSession::PosttHandler;
    using HttpFiled         = boost::beast::http::field;
    using HttpStatus        = boost::beast::http::status;
    class HttpServer {
    private:
        boost::asio::io_context& ctx;
        boost::asio::ip::tcp::acceptor acceptor;

        std::map<std::string, RequestHandler> get_handlers;
        std::map<std::string, PosttHandler> post_handlers;

    public:
        std::string doc_root;
        std::int32_t port;

    public:
        HttpServer(boost::asio::io_context& ctx, std::int32_t port = 8888, std::string doc_root = "./");
        ~HttpServer();

        RequestHandler& get(std::string target);
        PosttHandler& post(std::string target);

    private:
    private:
        void do_accept();
    };
}  // namespace rdhttp

#endif  // __HTTP_SERVER
